package com.wc.fortnight_blue_bridge.Q240309.B_霓虹;

import java.util.Scanner;

/**
 * @Author congge
 * @Date 2024/3/9 19:16
 * @description https://www.lanqiao.cn/problems/17003/learning/?contest_id=174
 */
public class Main {
    static int[][] f = new int[10][10];
    static int N = 100010;
    static char[] s;
    static char[] t;
    static int[][] a = new int[10][10];

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        f[0] = new int[]{0, 1, 1, 1, 0, 1, 1, 1};
        f[1] = new int[]{0, 0, 0, 1, 0, 0, 1, 0};
        f[2] = new int[]{0, 1, 0, 1, 1, 1, 0, 1};
        f[3] = new int[]{0, 1, 0, 1, 1, 0, 1, 1};
        f[4] = new int[]{0, 0, 1, 1, 1, 0, 1, 0};
        f[5] = new int[]{0, 1, 1, 0, 1, 0, 1, 1};
        f[6] = new int[]{0, 1, 1, 0, 1, 1, 1, 1};
        f[7] = new int[]{0, 1, 0, 1, 0, 0, 1, 0};
        f[8] = new int[]{0, 1, 1, 1, 1, 1, 1, 1};
        f[9] = new int[]{0, 1, 1, 1, 1, 0, 1, 1};

        for (int i = 0; i <= 9; i++) {
            for (int j = i + 1; j <= 9; j++) {
                a[i][j] = a[j][i] = work(i, j);
            }
        }
        s = (" " + sc.next()).toCharArray();
        t = (" " + sc.next()).toCharArray();
        int len = s.length;
        int res = 0;
        for (int i = 1; i < len; i++) {
            res += a[s[i] - '0'][t[i] - '0'];
        }
        System.out.println(res);
    }

    static int work(int x, int y) {
        int res = 0;
        for (int i = 1; i <= 7; i++) {
            if (f[x][i] != f[y][i]) {
                res++;
            }
        }
        return res;
    }
}
